package com.lmy.springCloud.controller;

import com.lmy.springCloud.entity.Order;
import com.lmy.springCloud.service.OrderService;
import com.lmy.springCloud.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@Slf4j
public class OrderController {

    @Resource
    private OrderService orderService;

    @PostMapping("/order/save")
    public Result save(@RequestBody Order order) {
        log.info("order:{}", order.toString());
        orderService.save(order);
        return Result.success(null, "创建订单成功");
    }
}
